package beans;

import java.sql.Timestamp;

/**
 * Bean for managing Messages data extracted from the database;
 * each bean represents ONE message instance.
 * Messages are NOT entities in the database, as they gather different attributes from the SEND, USERR and MESSAGE tables
 * through a JOIN operation.
 * The structure is based on what is going to presented on the web page.
 * @author Francesco Anderloni
 * @version 2
 *
 */
public class MessageBean {
	private String sender;
	private String senderName;
	private int commentID;
	private boolean isPrivate;
	private String body;
	private Timestamp stamp;
	private String receiver;
	private String receiverName;
	private int inReplyTo;
	private boolean showToSender;
	private boolean showToReceiver;

	/**
	 * @return The content of the "Sender" attribute.
	 */
	public String getSender() {
		return sender;
	}
	/**
	 * Set the "sender" field of a message.
	 * @param sender
	 */
	public void setSender(String sender) {
		this.sender = sender;
	}
	public String getSenderName() {
		return senderName;
	}
	public void setSenderName(String senderName) {
		this.senderName = senderName;
	}
	public String getReceiver() {
		return receiver;
	}
	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}
	public String getReceiverName() {
		return receiverName;
	}
	public void setReceiverName(String receiverName) {
		this.receiverName = receiverName;
	}
	public int getCommentID() {
		return commentID;
	}
	public void setCommentID(int commentID) {
		this.commentID = commentID;
	}
	public boolean isPrivate() {
		return isPrivate;
	}
	public void setPrivate(boolean isPrivate) {
		this.isPrivate = isPrivate;
	}
	public boolean getShowToSender() {
		return showToSender;
	}
	public void setShowToSender(boolean isPrivate) {
		this.showToSender = isPrivate;
	}
	public boolean getShowToReceiver() {
		return showToReceiver;
	}
	public void setShowToReceiver(boolean isPrivate) {
		this.showToReceiver = isPrivate;
	}
	public int getReplyTo() {
		return inReplyTo;
	}
	public void setReplyTo(int replyId) {
		this.inReplyTo = replyId;
	}
	public String getBody() {
		return body;
	}
	public void setBody(String body) {
		this.body = body;
	}
	public Timestamp getStamp() {
		return stamp;
	}
	public void setStamp(Timestamp stamp) {
		this.stamp = stamp;
	}

	public MessageBean() {
		sender = null;
	}

	public MessageBean(String sender, String receiver, boolean isPrivate, String body, Integer replyTo) {
		this.sender = sender;
		this.receiver = receiver;
		this.isPrivate = isPrivate;
		this.body = body;
		this.inReplyTo = replyTo;
	}
	
	public MessageBean(String sender, String senderName, String receiver,
			String receiverName, int commentID, boolean isPrivate, String body,
			Timestamp stamp, int inReplyTo, boolean showToSender,
			boolean showToReceiver) {
		super();
		this.sender = sender;
		this.senderName = senderName;
		this.receiver = receiver;
		this.receiverName = receiverName;
		this.commentID = commentID;
		this.isPrivate = isPrivate;
		this.body = body;
		this.stamp = stamp;
		this.inReplyTo = inReplyTo;
		this.showToSender = showToSender;
		this.showToReceiver = showToReceiver;
	}
	
}
